package com.xcdh.test.controller;

import com.xcdh.domain.vo.R;
import com.xcdh.test.entity.One;
import com.xcdh.test.service.OneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * OneController
 * Created by wjg on 2024/2/2.
 */
@RestController
@RequestMapping("/one")
public class OneController {
    @Autowired
    private OneService oneService ;

    @PostMapping("/queryById/{id}")
    public R<One> queryById(@PathVariable Integer id){
        return R.okData(oneService.selectById(id));
    }


    @PostMapping("/queryChild/{id}")
    public R<List<One>> queryChild(@PathVariable Integer id){
        return R.okData(oneService.selectByChild(id));
    }

}
